\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface}{
\section{Zebulon::CoralAHRS::Interface Class Reference}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface}\index{Zebulon::CoralAHRS::Interface@{Zebulon::CoralAHRS::Interface}}
}


\hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface}{Interface} class for the Coral AHRS Digital Compass.  


{\ttfamily \#include $<$interface.h$>$}\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
class \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_1_1_callback}{Callback}
\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a4406d74c75bdfe150bf72be1f1cda8b1}{
\hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a4406d74c75bdfe150bf72be1f1cda8b1}{Interface} ()}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a4406d74c75bdfe150bf72be1f1cda8b1}

\begin{DoxyCompactList}\small\item\em Constructor. \item\end{DoxyCompactList}\item 
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a19179888f29f18f1be54a3dfe98f68c0}{
\hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a19179888f29f18f1be54a3dfe98f68c0}{$\sim$Interface} ()}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a19179888f29f18f1be54a3dfe98f68c0}

\begin{DoxyCompactList}\small\item\em Destructor. \item\end{DoxyCompactList}\item 
bool \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a3369510e177b4cc73cdc54b7504e92f9}{EstablishConnection} (const std::string \&port, const unsigned short baud=57600)
\begin{DoxyCompactList}\small\item\em Establishes a connection to the device by searching different BAUDS on a port. \item\end{DoxyCompactList}\item 
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a12ac9d9b3a2beb2f1b7a755a84217f43}{
void \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a12ac9d9b3a2beb2f1b7a755a84217f43}{Shutdown} ()}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a12ac9d9b3a2beb2f1b7a755a84217f43}

\begin{DoxyCompactList}\small\item\em Shutsdown the interface. \item\end{DoxyCompactList}\item 
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_aaeacad2027ea3daaf888e34827b54c44}{
bool {\bfseries SetOutputModeEuler} ()}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_aaeacad2027ea3daaf888e34827b54c44}

\item 
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_adc4ee17131c26b67495a7133a31ee79d}{
bool {\bfseries IsConnected} () const }
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_adc4ee17131c26b67495a7133a31ee79d}

\item 
bool \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a4383a5e77edad2148f762ad1f15fe143}{Send} (const \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_message}{Message} $\ast$message)
\begin{DoxyCompactList}\small\item\em Sends the message over the serial port to the device. \item\end{DoxyCompactList}\item 
bool \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_afb36898667e8387d40ddffdc82974732}{RegisterCallback} (const unsigned char type, \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_1_1_callback}{Callback} $\ast$cb)
\begin{DoxyCompactList}\small\item\em Use this method to register a callback to be run whenever a specific type of message is received. \item\end{DoxyCompactList}\item 
void \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_ad21546519cc84c4fa20da320daca22dc}{RemoveCallback} (const unsigned char type, \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_1_1_callback}{Callback} $\ast$cb)
\begin{DoxyCompactList}\small\item\em Use this method to unregister a callback. \item\end{DoxyCompactList}\item 
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a17bfd769f78fabf29b2a2c56598f3bb9}{
void \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a17bfd769f78fabf29b2a2c56598f3bb9}{ClearCallback} ()}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a17bfd769f78fabf29b2a2c56598f3bb9}

\begin{DoxyCompactList}\small\item\em Clears all registered callbacks. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_message}{Message} $\ast$ \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a8ddab79ec75c4ac819335337deb1b414}{CreateMessage} (const unsigned char type)
\begin{DoxyCompactList}\small\item\em This method is used to create an instance of any type of Coral AHRS message. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
static void \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a4519eb06eee1c3cbf58899d745eb152c}{CoralThread} (void $\ast$arg)
\begin{DoxyCompactList}\small\item\em Thread used to receive data from sensor. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_ab71356bf0fc8cbea1a65b267a6a0955b}{
CxUtils::Thread \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_ab71356bf0fc8cbea1a65b267a6a0955b}{mCoralThread}}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_ab71356bf0fc8cbea1a65b267a6a0955b}

\begin{DoxyCompactList}\small\item\em Manages/creates thread. \item\end{DoxyCompactList}\item 
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a45c254b8b89c679ec5bee1cb7e9f7353}{
CxUtils::Mutex \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a45c254b8b89c679ec5bee1cb7e9f7353}{mCoralMutex}}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a45c254b8b89c679ec5bee1cb7e9f7353}

\begin{DoxyCompactList}\small\item\em Mutex for thread protection of data members. \item\end{DoxyCompactList}\item 
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_ad84f253e059ed2c8173494aed550dfac}{
CxUtils::Serial \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_ad84f253e059ed2c8173494aed550dfac}{mSerial}}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_ad84f253e059ed2c8173494aed550dfac}

\begin{DoxyCompactList}\small\item\em Connection to serial port. \item\end{DoxyCompactList}\item 
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a9f76bb649979fde73675d20b1d430893}{
volatile bool \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a9f76bb649979fde73675d20b1d430893}{mValidDataFlag}}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a9f76bb649979fde73675d20b1d430893}

\begin{DoxyCompactList}\small\item\em Flag indicates that valid data/communication has occured with sensor. \item\end{DoxyCompactList}\item 
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a62a728e96de9894b546cc6a59eae0d88}{
\hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_message_a006956e9d5085ec053f20da9047dda7a}{Message::List} \hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a62a728e96de9894b546cc6a59eae0d88}{mMessageQueue}}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a62a728e96de9894b546cc6a59eae0d88}

\begin{DoxyCompactList}\small\item\em Queue of received Coral AHRS messages. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
\hyperlink{class_zebulon_1_1_coral_a_h_r_s_1_1_interface}{Interface} class for the Coral AHRS Digital Compass. 

\subsection{Member Function Documentation}
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a4519eb06eee1c3cbf58899d745eb152c}{
\index{Zebulon::CoralAHRS::Interface@{Zebulon::CoralAHRS::Interface}!CoralThread@{CoralThread}}
\index{CoralThread@{CoralThread}!Zebulon::CoralAHRS::Interface@{Zebulon::CoralAHRS::Interface}}
\subsubsection[{CoralThread}]{\setlength{\rightskip}{0pt plus 5cm}void Interface::CoralThread (void $\ast$ {\em arg})\hspace{0.3cm}{\ttfamily  \mbox{[}static, protected\mbox{]}}}}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a4519eb06eee1c3cbf58899d745eb152c}


Thread used to receive data from sensor. Runs a thread which continuously receives and parsed data from serial port. \hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a8ddab79ec75c4ac819335337deb1b414}{
\index{Zebulon::CoralAHRS::Interface@{Zebulon::CoralAHRS::Interface}!CreateMessage@{CreateMessage}}
\index{CreateMessage@{CreateMessage}!Zebulon::CoralAHRS::Interface@{Zebulon::CoralAHRS::Interface}}
\subsubsection[{CreateMessage}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Message} $\ast$ Interface::CreateMessage (const unsigned char {\em type})\hspace{0.3cm}{\ttfamily  \mbox{[}static\mbox{]}}}}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a8ddab79ec75c4ac819335337deb1b414}


This method is used to create an instance of any type of Coral AHRS message. 
\begin{DoxyParams}{Parameters}
\item[\mbox{$\leftarrow$} {\em type}]The type of message to create.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Pointer to created message (you must delete it), NULL if type is unknown. 
\end{DoxyReturn}
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a3369510e177b4cc73cdc54b7504e92f9}{
\index{Zebulon::CoralAHRS::Interface@{Zebulon::CoralAHRS::Interface}!EstablishConnection@{EstablishConnection}}
\index{EstablishConnection@{EstablishConnection}!Zebulon::CoralAHRS::Interface@{Zebulon::CoralAHRS::Interface}}
\subsubsection[{EstablishConnection}]{\setlength{\rightskip}{0pt plus 5cm}bool Interface::EstablishConnection (const std::string \& {\em port}, \/  const unsigned short {\em baud} = {\ttfamily 57600})}}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a3369510e177b4cc73cdc54b7504e92f9}


Establishes a connection to the device by searching different BAUDS on a port. 
\begin{DoxyParams}{Parameters}
\item[\mbox{$\leftarrow$} {\em port}]The port name to connect on. \item[\mbox{$\leftarrow$} {\em baud}]The initial/first BAUD to try.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
True if connection established, otherwise false. 
\end{DoxyReturn}
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_afb36898667e8387d40ddffdc82974732}{
\index{Zebulon::CoralAHRS::Interface@{Zebulon::CoralAHRS::Interface}!RegisterCallback@{RegisterCallback}}
\index{RegisterCallback@{RegisterCallback}!Zebulon::CoralAHRS::Interface@{Zebulon::CoralAHRS::Interface}}
\subsubsection[{RegisterCallback}]{\setlength{\rightskip}{0pt plus 5cm}bool Interface::RegisterCallback (const unsigned char {\em type}, \/  {\bf Callback} $\ast$ {\em cb})}}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_afb36898667e8387d40ddffdc82974732}


Use this method to register a callback to be run whenever a specific type of message is received. 
\begin{DoxyParams}{Parameters}
\item[\mbox{$\leftarrow$} {\em type}]The type of message to subscribe to. \item[\mbox{$\leftarrow$} {\em cb}]The callback to be run when the message is received.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
True on success, false on failure. 
\end{DoxyReturn}
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_ad21546519cc84c4fa20da320daca22dc}{
\index{Zebulon::CoralAHRS::Interface@{Zebulon::CoralAHRS::Interface}!RemoveCallback@{RemoveCallback}}
\index{RemoveCallback@{RemoveCallback}!Zebulon::CoralAHRS::Interface@{Zebulon::CoralAHRS::Interface}}
\subsubsection[{RemoveCallback}]{\setlength{\rightskip}{0pt plus 5cm}void Interface::RemoveCallback (const unsigned char {\em type}, \/  {\bf Callback} $\ast$ {\em cb})}}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_ad21546519cc84c4fa20da320daca22dc}


Use this method to unregister a callback. 
\begin{DoxyParams}{Parameters}
\item[\mbox{$\leftarrow$} {\em type}]The type of message to subscribe to. \item[\mbox{$\leftarrow$} {\em cb}]The callback to be run when the message is received. \end{DoxyParams}
\hypertarget{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a4383a5e77edad2148f762ad1f15fe143}{
\index{Zebulon::CoralAHRS::Interface@{Zebulon::CoralAHRS::Interface}!Send@{Send}}
\index{Send@{Send}!Zebulon::CoralAHRS::Interface@{Zebulon::CoralAHRS::Interface}}
\subsubsection[{Send}]{\setlength{\rightskip}{0pt plus 5cm}bool Interface::Send (const {\bf Message} $\ast$ {\em message})}}
\label{class_zebulon_1_1_coral_a_h_r_s_1_1_interface_a4383a5e77edad2148f762ad1f15fe143}


Sends the message over the serial port to the device. 
\begin{DoxyParams}{Parameters}
\item[\mbox{$\leftarrow$} {\em message}]Pointer to message structure to transmit.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
True on success, false on failure. 
\end{DoxyReturn}


The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
C:/Users/Matt/Documents/School/Robotics/zebulon/v2/coralahrs/include/coralahrs/interface.h\item 
C:/Users/Matt/Documents/School/Robotics/zebulon/v2/coralahrs/src/coralahrs/interface.cpp\end{DoxyCompactItemize}
